#include <glib.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "../Vector.h"

int main(void) {
  const char text1[100] = "Test1";
  const char text2[100] = "Test2";
  const char text3[100] = "Test3";
  Vector*    vector     = vector_new(3);

  g_assert(vector_get(vector, 0) == NULL);
  g_assert(vector_get(vector, 1) == NULL);
  g_assert(vector_get(vector, 2) == NULL);

  vector_set(vector, 0, (void*)text1);
  g_assert(vector_get(vector, 0) != NULL);
  g_assert(strcmp(vector_get(vector, 0), "text1"));
  g_assert(vector_get(vector, 1) == NULL);
  g_assert(vector_get(vector, 2) == NULL);

  vector_set(vector, 2, (void*)text3);
  g_assert(vector_get(vector, 0) != NULL);
  g_assert(strcmp(vector_get(vector, 0), "text1"));
  g_assert(vector_get(vector, 1) == NULL);
  g_assert(vector_get(vector, 2) != NULL);
  g_assert(strcmp(vector_get(vector, 2), "text3"));

  vector_set(vector, 1, (void*)text2);
  g_assert(vector_get(vector, 0) != NULL);
  g_assert(strcmp(vector_get(vector, 0), "text1"));
  g_assert(vector_get(vector, 1) != NULL);
  g_assert(strcmp(vector_get(vector, 1), "text2"));
  g_assert(vector_get(vector, 2) != NULL);
  g_assert(strcmp(vector_get(vector, 2), "text3"));

  vector_free(vector);
  return 0;
}
